//
//  LeftMenuTableViewCell.m
//  BaishidaiKnight
//
//  Created by mac book on 2019/1/25.
//  Copyright © 2019年 sy. All rights reserved.
//

#import "LeftMenuTableViewCell.h"

@interface LeftMenuTableViewCell ()

@property(nonatomic,strong) UIImageView* iconImageView;
@property(nonatomic,strong) UILabel* labelTitle;
@property(nonatomic,strong) UIView * lineView;

@end

@implementation LeftMenuTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){

        self.contentView.backgroundColor =kMyColor(26, 28, 31);
        [self createSubviews];

    }
    return self;
}

#pragma mark - createSubviews
-(void)createSubviews{
    [self.contentView addSubview:self.iconImageView];
    [self.contentView addSubview:self.labelTitle];
    [self.contentView addSubview:self.lineView];
    
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.contentView);
        make.left.right.equalTo(self.contentView);
        make.height.mas_equalTo(1);
        
    }];
    
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(10);
        make.size.mas_equalTo(CGSizeMake(25, 25));
        
    }];
    
    [self.labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.equalTo(self.contentView);
        make.right.equalTo(self.contentView).offset(-10);
        make.left.equalTo(self.iconImageView.mas_right).offset(10);

    }];
    
    
}



#pragma mark =====================================================  property package

-(void)loadDataWithImage:(NSString *)imageName title:(NSString *)title{
    [self.iconImageView setImage:[UIImage imageNamed:imageName]];
    self.labelTitle.text = title;
}

-(UIImageView *)iconImageView{
    if(!_iconImageView){
        _iconImageView = [[UIImageView alloc]init];
    }
    return _iconImageView;
}

-(UILabel *)labelTitle{
    if(!_labelTitle){
        _labelTitle = [[UILabel alloc]init];
        _labelTitle.textColor = kMyColor(113, 113, 113);
        
        _labelTitle.font = [UIFont systemFontOfSize:15.f];
    }
    return _labelTitle;
}

-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = kMyColor(113, 113, 113);
    }
    return _lineView;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
